<!DOCTYPE HTML>
<html>
	<head>
		<title>liveplayer</title>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
		<script type="text/javascript" src="liveplayer-element.min.js"></script>
		<script type="text/javascript">
			window.onload = function() {

			}

			window.addEventListener("message", function(event) {
				var data = event.data;
				switch (data.cmd) {
					case 'switchUrl':
						// 处理业务逻辑
						console.log("收到消息："+JSON.stringify(data.params));
						var player = document.getElementById('player01');
						player.setAttribute("video-url",data.params["path"]);
						break;
				}
			});

			function getQueryVariable(variable) {
				var query = window.location.search.substring(1);
				var vars = query.split("&");
				for (var i = 0; i < vars.length; i++) {
					var pair = vars[i].split("=");
					if (pair[0] == variable) {
						return pair[1];
					}
				}
				return (false);
			}
		</script>
	</head>
	<body>
		<live-player id="player01" live="true" stretch="true" show-custom-button="false" autoplay>
		</live-player>
		<script>
			var videoPath = getQueryVariable("url");
			console.log('播放地址：' + videoPath);
			var player = document.getElementById('player01');
			player.setAttribute("video-url", videoPath);
		</script>
	</body>
</html>
